package com.parent.controller;

import com.parent.entity.SysUser;
import com.parent.mapper.SysUserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * com.parent.controller.TestController
 *
 * @author: wanglei62
 * @DATE: 2022/10/17 14:42
 **/
@Controller
@RequestMapping("/parent")



public class ParentController {
    @Autowired
    private SysUserMapper sysUserMapper;
    @RequestMapping("/test")
    public ResponseEntity<String> test(){
        System.out.println("parent test");
        return ResponseEntity.ok("SUCCESS");
    }

    @ResponseBody
    @RequestMapping(value="/selectById/{id}")
    //http://127.0.0.1:8899/thd/parent/selectById/1
    public ResponseEntity<SysUser> selectById(@PathVariable String id){
        SysUser user =  sysUserMapper.selectById(id);
        return ResponseEntity.ok(user);
    }


}
